const enum Direction {
    Up = "Up",
    Down = "Down",
    Left = "Left",
    Right = "Right",
}

let myDirection: Direction = Direction.Up;
console.log(myDirection); // 输出 0

const value:string = "Up"

if (value === Direction.Up) {
    console.log("go up");
}





const enum LogLevel {
    Info,
    Warning,
    Error,
}

function logMessage(message: string, level: LogLevel): void {
    switch (level) {
        case LogLevel.Info:
            console.log(`[INFO] ${message}`);
            break;
        case LogLevel.Warning:
            console.warn(`[WARNING] ${message}`);
            break;
        case LogLevel.Error:
            console.error(`[ERROR] ${message}`);
            break;
    }
}

// 使用函数
logMessage("This is an information message.", LogLevel.Info);
logMessage("This is a warning message.", LogLevel.Warning);
logMessage("This is an error message.", LogLevel.Error);
